# -*- coding:utf-8 -*-
class Solution:
    # s字符串
    def isNumeric(self, s):
        # write code here
        nums = [str(i) for i in range(10)]
        signal = ['+', '-']
        exp = ['e', 'E']
        dot = '.'
        num_dot = 0
        num_exp = 0
        for i in range(len(s)):
            if i == 0:
                if s[i] in nums or s[i] in signal:
                    continue
                else:
                    return False
            elif i == len(s)-1:
                if s[i] in nums:
                    continue
                else:
                    return False
            else:
                if s[i] in nums:
                    continue
                elif s[i] in exp and num_exp == 0:
                    num_exp += 1
                    continue
                elif s[i] in signal and num_exp == 1:
                    continue
                elif s[i] == dot and num_dot == 0 and num_exp == 0:
                    num_dot += 1

                else:
                    return False
        return True
#
# test = Solution()
# print(test.isNumeric('1.2.3'))

